﻿using MSocketCore.Hub;
using MSocketCore.MSocket;
using Topshelf;

namespace MSocketCore
{
    public class RegService : ServiceControl
    {
        private readonly MessageClient _client;
        private readonly ServerContainer _server;


        public RegService(ServerContainer server, MessageClient client)
        {
            _server = server;
            _client = client;
        }

        public bool Start(HostControl hostControl)
        {
            _server.Start();
            _client.Connect();
            return true;
        }

        public bool Stop(HostControl hostControl)
        {
            _server.Stop();
            _client.DisConnect();
            return true;
        }
    }
}